package com.teach;

import java.time.LocalDate;

/**
 * <pre>
 * - 母亲节5月的第2个星期天
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-4-16 14:27:04
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 *
 */
public class Demo0502 {

	public static void main(String[] args) {
		System.out.println(getFatherDay(2021));//5-9
		System.out.println(getFatherDay(2020));//5-10
	}
	
	
	public static LocalDate getFatherDay(int year) {
		LocalDate d = LocalDate.of(year, 5, 1);
		int w = d.getDayOfWeek().getValue();//1-7 周一-周日
		if(w==7) {
			d = d.plusDays(7);
		}else {
			d = d.plusDays(14-w);
		}
		return d;
	}
}
